<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>atan</title>
  </head>
  <body bgcolor="#FFFFFF">
    <center>Scilab Function</center>
    <div align="right">Last update : July 2001</div>
    <p>
      <b>atan</b> -  2-quadrant and 4-quadrant inverse tangent</p>
    <h3>
      <font color="blue">Calling Sequence</font>
    </h3>
    <dl>
      <dd>
        <tt>phi=atan(x)  </tt>
      </dd>
      <dd>
        <tt>phi=atan(y,x)  </tt>
      </dd>
    </dl>
    <h3>
      <font color="blue">Parameters</font>
    </h3>
    <ul>
      <li>
        <tt>
          <b>x</b>
        </tt>: real or complex scalar, vector or matrix</li>
      <li>
        <tt>
          <b>phi</b>
        </tt>: real or complex scalar, vector or matrix</li>
      <li>
        <tt>
          <b>x, y</b>
        </tt>: real scalars, vectors or matrices of the same size</li>
      <li>
        <tt>
          <b>phi</b>
        </tt>: real scalar, vector or matrix</li>
    </ul>
    <h3>
      <font color="blue">Description</font>
    </h3>
    <p>
    The first form computes the 2-quadrant inverse tangent, which is the
    inverse of <tt>
        <b>tan(phi)</b>
      </tt>.  For real <tt>
        <b>x</b>
      </tt>, <tt>
        <b>phi</b>
      </tt> is in the
    interval (-pi/2, pi/2).  For complex <tt>
        <b>x</b>
      </tt>, <tt>
        <b>atan</b>
      </tt> has two
    singular, branching points <tt>
        <b>+%i</b>
      </tt>,<tt>
        <b>-%i</b>
      </tt> and the chosen branch
    cuts are the two imaginary half-straight lines [i, i*oo) and (-i*oo, -i].</p>
    <p>
    The second form computes the 4-quadrant arctangent (atan2 in
    Fortran), this is, it returns the argument (angle) of the complex
    number <tt>
        <b>x+i*y</b>
      </tt>.  The range of <tt>
        <b>atan(y,x)</b>
      </tt> is (-pi, pi].</p>
    <p>
    For real arguments, both forms yield identical values if <tt>
        <b>x&gt;0</b>
      </tt>.</p>
    <p>
    In case of vector or matrix arguments, the evaluation is done
    element-wise, so that <tt>
        <b>phi</b>
      </tt> is a vector or matrix of the same size
    with <tt>
        <b>phi(i,j)=atan(x(i,j))</b>
      </tt> or <tt>
        <b>phi(i,j)=tan(y(i,j),x(i,j))</b>
      </tt>.</p>
    <h3>
      <font color="blue">Examples</font>
    </h3>
    <pre>

// examples with the second form
x=[1,%i,-1,%i]
phasex=atan(imag(x),real(x))
atan(0,-1)
atan(-%eps,-1)

// branch cuts
atan(-%eps + 2*%i)
atan(+%eps + 2*%i)
atan(-%eps - 2*%i)
atan(+%eps - 2*%i)

// values at the branching points
ieee(2)
atan(%i)
atan(-%i)
 
  </pre>
    <h3>
      <font color="blue">See Also</font>
    </h3>
    <p>
      <a href="tan.htm">
        <tt>
          <b>tan</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="../programming/ieee.htm">
        <tt>
          <b>ieee</b>
        </tt>
      </a>,&nbsp;&nbsp;</p>
    <h3>
      <font color="blue">Authors</font>
    </h3>
    <dl>
      <dd>
        <b></b>B.P.</dd>
      <dd>
        <b></b>L.V.D.
    <em>(authors of the complex atan function).</em>
      </dd>
    </dl>
  </body>
</html>
